//
//  RequestManger.h
//  MyPorject
//
//  Created by Yuki on 2021/1/26.
//

#import <Foundation/Foundation.h>
#import <AFNetworking.h>///网络请求
#import "NSString+EL.h"
#import "BusinessHeader.h"

NS_ASSUME_NONNULL_BEGIN
@interface RequestManger : NSObject<NSCopying>
/// 单例初始化
+ (instancetype)shareInstance;


/// post请求，请求参数不放在body中
/// @param cmdStr 请求地址
/// @param param 请求参数
/// @param successBlock 成功回调
/// @param failuredBlock 失败回调
- (void)postRequestWithCmdStr:(NSString *)cmdStr
                    withParam:(NSDictionary *)param
                 successBlock:(void(^)(NSDictionary *respDic))successBlock
                failuredBlock:(void(^)(NSString *errorStr))failuredBlock NS_DEPRECATED(2_0, 2_0, 2_0, 2_0, "这个post方法被废弃，请用 postRequest_bodyWithCmdStr");

/// post请求，请求参数放在body中
/// @param cmdStr 请求地址
/// @param param 请求参数
/// @param successBlock 成功回调
/// @param failuredBlock 失败回调
- (void)postRequest_bodyWithCmdStr:(NSString *)cmdStr
                         withParam:(NSDictionary *)param
                      successBlock:(void (^)(NSDictionary *respDic))successBlock
                     failuredBlock:(void (^)(NSString *errorStr))failuredBlock;

- (void)postUploadImgWithCmdStr:(NSString *)cmdStr
                         withImage:(UIImage *)img
                      successBlock:(void (^)(NSDictionary *respDic))successBlock
                  failuredBlock:(void (^)(NSString *errorStr))failuredBlock;

/// get请求 为货币列表使用
/// @param cmdStr 请求地址
/// @param param 请求参数
/// @param successBlock 成功回调
/// @param failuredBlock 失败回调
- (void)getRequestWithCmdStr:(NSString *)cmdStr
                    withParam:(NSDictionary *)param
                 successBlock:(void(^)(NSDictionary *respDic))successBlock
                  failuredBlock:(void(^)(NSString *errorStr))failuredBlock;


///请求URL
- (void)getURLRequestWithCmdStr:(NSString *)cmdStr
                    withParam:(NSDictionary *)param
                 successBlock:(void(^)(NSDictionary *respDic))successBlock
                  failuredBlock:(void(^)(NSString *errorStr))failuredBlock;
@end

NS_ASSUME_NONNULL_END
